class AdminController < ApplicationController
  # if scaffold was not used, enter following line to add layout
  layout 'admins'

  def login
    if request.post?
	  user = User.authentication(params[:name], params[:password])
	  if user
	    session[:user_id] = user.id
		redirect_to :controller => 'user_main', :action => 'index'
	  else
	    flash[:notice] = "Invalid username/password combination"
		redirect_to :controller => 'home', :action => 'index'
	  end
	end
  end

  def logout
    session[:user_id] = nil
	flash[:notice] = "Logged out"
	redirect_to :controller => 'home', :action => 'index'
  end

  def index
  end

end
